home *** CD-ROM | disk | FTP | other *** search
/ ShareWare OnLine 2 / ShareWare OnLine Volume 2 (CMS Software)(1993).iso / prog / fpclib36.zip / EXAMPLES / EXAMPLE.C next >
C/C++ Source or Header  |  1993-03-25  |  8KB  |  334 lines

  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. #include <memory.h>
  5. #include <fpclib.h>
  6.  
  7. /*---------------------------------------------------------------
  8. -
  9. - EXAMPLExxx where xxx is the number of the example to compile
  10. -
  11. - #define EXAMPLExxx  1
  12. -
  13. ---------------------------------------------------------------*/
  14.  
  15. #define EXAMPLE010  1
  16.  
  17. /*----------------------------------------------------------
  18. -
  19. ----------------------------------------------------------*/
  20. #if defined(EXAMPLE001)
  21.  
  22. void main( void )
  23. {
  24.    VioInit();
  25. }
  26.  
  27. /*----------------------------------------------------------
  28. -
  29. ----------------------------------------------------------*/
  30. #if defined(EXAMPLE002)
  31.  
  32. void main( void )
  33. {
  34.    int i;
  35.  
  36.    VioInit();
  37.    ClrWin( 1, 1, 80, 25, 7 );
  38.    for ( i = 0; i < 16; i++ ) {
  39.       DspMsg( 1, i+1, "                                      " );
  40.       BorderColor( i );
  41.       ColorMsg( 1, i+2, i+1, "Press any key to see next border color" );
  42.       GotoxyAbs( 1, i+2 );
  43.       GetKey();
  44.    }
  45.    BorderColor( 0 );
  46.    ClrWin( 1, 1, 80, 25, 7 );
  47.    GotoxyAbs( 1, 1 );
  48. }
  49.  
  50. /*----------------------------------------------------------
  51. -
  52. ----------------------------------------------------------*/
  53. #elif defined(EXAMPLE003)
  54.  
  55. char TCSet[32] = {  0,101,  0,0,0,0, 0,24,
  56.                    57,213,192,0,0,0,95, 0,
  57.                     8,  0,  0,0,0,0, 0, 0,
  58.                     0,  0,  0,0,0,0, 0, 0
  59.                  };
  60.  
  61. char VCSet[32] = {   0,  0,  0,  0,255,255,255,255,
  62.                    255,255,255,255,255,255,255,255,
  63.                    255,255,255,255,255,255,255,255,
  64.                    255,255,255,255,255,255,255,255
  65.                  };
  66.  
  67. char *prompt = "Enter name:";
  68.  
  69. void main( void )
  70. {
  71.    char  st[256];
  72.    int   x1       = 1;
  73.    int   y1       = 1;
  74.    int   stpt     = ( x1 + 20 ) - (strlen( prompt ) / 2);
  75.    int   CharOfs  = 1;
  76.    int   TE       = 0;
  77.    int   WinColor = 0x17;
  78.  
  79.    VioInit();
  80.  
  81.    memset( st, 0, 256 );
  82.    ClrWin( 1, 1, 80, 25, 7 );
  83.  
  84.  
  85.    ClrWin( x1, y1, x1+40, y1+5, WinColor);
  86.    WindowFP( x1, y1, x1+40, y1+5 );
  87.    FrameWin( '╔', '╗', '╚', '╝', '═', '║', WinColor );
  88.  
  89.    WindowFP( x1+1, y1+2, x1+39, y1+4 );
  90.    FrameWin( '┌', '┐', '└', '┘', '─', '│', WinColor );
  91.  
  92.    ColorMsg( stpt, y1+1, WinColor, prompt );
  93.  
  94.    EditSt( y1+3,          // Row
  95.            x1+2,          // Start Column
  96.            x1+38,         // Stop Column
  97.            40,            // Length
  98.            1,             // Character Case Mode
  99.            7,             // Fill Character
  100.            0,             // Auto Skip Mode
  101.            7000,          // Error Tone
  102.            2000,          // Error Duration
  103.            VCSet,         // Valid Character Set
  104.            TCSet,         // Terminating Character Set
  105.            &CharOfs,      // Cursor Position in string being edited
  106.            &TE,           // Terminating Element Value
  107.            st );          // String being edited
  108.  
  109.    GotoxyAbs( x1, y1+6 );
  110.    WriteSt( "Prompt entered: ***" );
  111.    WriteSt( st );
  112.    WriteStln( "***" );
  113. }
  114.  
  115. /*----------------------------------------------------------
  116. -
  117. ----------------------------------------------------------*/
  118. #elif defined(EXAMPLE004)
  119.  
  120. void main( void )
  121. {
  122.    int   x1       = 1;
  123.    int   y1       = 1;
  124.    int   WinColor = 0x17;
  125.  
  126.    VioInit();
  127.  
  128.    ClrWin( 1, 1, 80, 25, 7 );
  129.    GotoxyAbs( 1, 1 );
  130.  
  131.    ClrWin( x1, y1, x1+40, y1+10, WinColor);
  132.    WindowFP( x1, y1, x1+40, y1+10 );
  133.    FrameWin( '╔', '╗', '╚', '╝', '═', '║', WinColor );
  134.  
  135.    FillRowChar( x1+40, y1+1, 1, 0x18 );
  136.    FillColChar( x1+40, y1+2, 7, '▒'  );
  137.  
  138.    FillColAttr( x1+40, y1+2, 7, 0x18 );
  139.    FillRowChar( x1+40, y1+9, 1, 0x19 );
  140. }
  141.  
  142.  
  143. /*----------------------------------------------------------
  144. -
  145. ----------------------------------------------------------*/
  146. #elif defined(EXAMPLE005)
  147.  
  148. void main( void )
  149. {
  150.    int   x1       = 1;
  151.    int   y1       = 1;
  152.    int   WinColor = 0x17;
  153.  
  154.    VioInit();
  155.  
  156.    ClrWin( 1, 1, 80, 25, 7 );
  157.    GotoxyAbs( 1, 1 );
  158.  
  159.    ClrWin( x1, y1, x1+40, y1+10, WinColor);
  160.    WindowFP( x1, y1, x1+40, y1+10 );
  161.    FrameWin( '╔', '╗', '╚', '╝', '═', '║', WinColor );
  162.  
  163.    FillRowChar( x1+40, y1+1, 1, 0x18 );
  164.    FillColCell( x1+40, y1+2, 7, 0xb118 );  // (177 - char) (0x18 - attrib)
  165.    FillRowChar( x1+40, y1+9, 1, 0x19 );
  166. }
  167.  
  168. /*----------------------------------------------------------
  169. -
  170. ----------------------------------------------------------*/
  171. #elif defined(EXAMPLE006)
  172.  
  173. void main( void )
  174. {
  175.    int   i;
  176.    int   x1       = 1;
  177.    int   y1       = 1;
  178.    int   WinColor = 0x17;
  179.  
  180.    VioInit();
  181.  
  182.    ClrWin( 1, 1, 80, 25, 7 );
  183.    GotoxyAbs( 1, 1 );
  184.  
  185.    ClrWin( x1, y1, x1+40, y1+10, WinColor);
  186.    WindowFP( x1, y1, x1+40, y1+10 );
  187.    FrameWin( '╔', '╗', '╚', '╝', '═', '║', WinColor );
  188.  
  189.    for ( i = y1+1; i <= y1+9; i++ )
  190.       DspMsg( x1+1, i, "This is an example message" );
  191.  
  192.    DspMsg( x1+2, y1+10, "Press any key to continue" );
  193.    GetKey();
  194.    FillFrameChar( x1+1, y1+1, x1+39, y1+9, '░' );
  195.  
  196.    DspMsg( x1+2, y1+10, "Press enter to continue  " );
  197.    GetKey();
  198.    FillFrameAttr( x1+1, y1+1, x1+39, y1+9, RvsAttr( WinColor ) );
  199.  
  200.    DspMsg( x1+2, y1+10, "Press enter to quit      " );
  201.    GetKey();
  202. }
  203.  
  204. /*----------------------------------------------------------
  205. -
  206. ----------------------------------------------------------*/
  207. #elif defined(EXAMPLE007)
  208.  
  209. void main( void )
  210. {
  211.    int   i;
  212.    int   x1       = 1;
  213.    int   y1       = 1;
  214.    int   WinColor = 0x17;
  215.  
  216.    VioInit();
  217.  
  218.    ClrWin( 1, 1, 80, 25, 7 );
  219.    GotoxyAbs( 1, 1 );
  220.  
  221.    ClrWin( x1, y1, x1+40, y1+10, WinColor);
  222.    WindowFP( x1, y1, x1+40, y1+10 );
  223.    FrameWin( '╔', '╗', '╚', '╝', '═', '║', WinColor );
  224.  
  225.    for ( i = y1+1; i <= y1+9; i++ )
  226.       DspMsg( x1+1, i, "This is an example message" );
  227.  
  228.    DspMsg( x1+2, y1+10, "Press any key to continue" );
  229.    GetKey();
  230.    FillFrameCell( x1+1, y1+1, x1+39, y1+9, 0xb100 + RvsAttr( WinColor ) );
  231.  
  232.    DspMsg( x1+2, y1+10, "Press enter to quit      " );
  233.    GetKey();
  234. }
  235.  
  236. /*----------------------------------------------------------
  237. -
  238. ----------------------------------------------------------*/
  239. #elif defined(EXAMPLE008)
  240.  
  241. void main( void )
  242. {
  243.    int   x1       = 20;
  244.    int   y1       = 5;
  245.    int   WinColor = 0x17;
  246.  
  247.    VioInit();
  248.  
  249.    ClrWin( 1, 1, 80, 25, 7 );
  250.    GotoxyAbs( 1, 1 );
  251.  
  252.    FillRowChar( 1, 1, 2000, '░'  );
  253.    FillRowAttr( 1, 1, 2000, 0x17 );
  254.  
  255.    ClrWin( x1, y1, x1+40, y1+10, WinColor);
  256.    WindowFP( x1, y1, x1+40, y1+10 );
  257.    FrameWin( '╔', '╗', '╚', '╝', '═', '║', WinColor );
  258.  
  259.    FillColAttr( x1+41, y1+1,  10, 0x00 );
  260.    FillRowAttr( x1+1,  y1+11, 41, 0x00 );
  261.  
  262.    DspMsg( x1+1, y1+1, "Press any key to continue..." );
  263.    GetKey();
  264.  
  265.    ClrWin( 1, 1, 80, 25, 7 );
  266.    GotoxyAbs( 1, 1 );
  267. }
  268.  
  269. /*----------------------------------------------------------
  270. -
  271. ----------------------------------------------------------*/
  272. #elif defined(EXAMPLE009)
  273.  
  274. void main( void )
  275. {
  276.    int   x1       = 20;
  277.    int   y1       = 5;
  278.    int   WinColor = 0x17;
  279.  
  280.    VioInit();
  281.  
  282.    ClrWin( 1, 1, 80, 25, 7 );
  283.    GotoxyAbs( 1, 1 );
  284.  
  285.    FillRowCell( 1, 1, 2000, 0xb100 + WinColor );
  286.  
  287.    ClrWin( x1, y1, x1+40, y1+10, WinColor);
  288.    WindowFP( x1, y1, x1+40, y1+10 );
  289.    FrameWin( '╔', '╗', '╚', '╝', '═', '║', WinColor );
  290.  
  291.    FillColAttr( x1+41, y1+1,  10, 0x00 );
  292.    FillRowAttr( x1+1,  y1+11, 41, 0x00 );
  293.  
  294.    DspMsg( x1+1, y1+1, "Press any key to continue..." );
  295.    GetKey();
  296.  
  297.    ClrWin( 1, 1, 80, 25, 7 );
  298.    GotoxyAbs( 1, 1 );
  299. }
  300.  
  301. /*----------------------------------------------------------
  302. -
  303. ----------------------------------------------------------*/
  304. #elif defined(EXAMPLE010)
  305.  
  306. void main( void )
  307. {
  308.    char  st[20];
  309.    INT2  cursor;
  310.  
  311.  
  312.    VioInit();
  313.  
  314.    ClrWin( 1, 1, 80, 25, 7 );
  315.    GotoxyAbs( 1, 1 );
  316.  
  317.    cursor = GetCursorSize();
  318.  
  319.    sprintf( st, "Starting Scan Line: %d", ( cursor >> 8 ) );
  320.    WriteStln( st );
  321.  
  322.    sprintf( st, "Ending Scan Line  : %d", ( cursor & 0x00FF ) );
  323.    WriteStln( st );
  324.  
  325.    WriteStln( "Press any key to continue..." );
  326.    GetKey();
  327.  
  328.    ClrWin( 1, 1, 80, 25, 7 );
  329.    GotoxyAbs( 1, 1 );
  330. }
  331.  
  332.  
  333. #endif
  334.